import { request } from "@/utils/service"
interface IRole {
  id?: number
  roleName: string
  roleCode: string
  type: number
  enable: number
}
interface IGetRoleListApiData {
  /** 当前页码 */
  pageNum: number
  /** 查询条数 */
  pageSize: number
  /** 查询参数 */
  account?: string
  mobileNumber?: string
}
interface ISwitchEnableApiData {
  id: number
  enable: number
}
interface IChnageRoleNameApiData {
  id: number
  roleName: string
}
export function getRoleListApi(params: IGetRoleListApiData) {
  return request({
    url: "/system/role/list",
    method: "get",
    params
  })
}
export function createRoleApi(data: IRole) {
  return request({
    url: "/system/role/create",
    method: "post",
    data
  })
}
export function switchRoleEnableApi(data: ISwitchEnableApiData) {
  return request({
    url: "/system/role/switchEnable",
    method: "post",
    data
  })
}
export function changeRoleNameApi(data: IChnageRoleNameApiData) {
  return request({
    url: "/system/role/changeName",
    method: "post",
    data
  })
}
export function deleteRoleApi(id: number) {
  return request({
    url: "/system/role/" + id,
    method: "delete"
  })
}
